import xlrd,app
from selenium.webdriver import Chrome


def headers(self):
    response = self.login_api.get_coken({"mobile": "13800000002", "password": "123456"})
    app.TOKEN = "Bearer " + response.json().get('data')


def data_build(f=app.TEST_CASE_PATH):
    data_list = []
    data_dict_keys = []

    data = xlrd.open_workbook(f)  # 打开xls文件
    table = data.sheets()[0]  # 打开第一张表
    for i in table.row_values(0):  # 获取参数名
        data_dict_keys.append(i)

    for i in range(1, table.nrows):
        data_dict_values = table.row_values(i)
        temp_dict = dict(zip(data_dict_keys, data_dict_values))
        temp_list=[]
        temp_list.append(temp_dict)
        data_list.append(tuple(temp_list))
    return data_list


# def data_build(f=app.TEST_CASE_PATH):
#     data_list = []
#     data = xlrd.open_workbook(f)  # 打开xls文件
#     table = data.sheets()[0]  # 打开第一张表
#     for i in range(1, table.nrows):
#         data_list.append(tuple(table.row_values(i)))
#     return data_list
# data_build()